package com.jdd.modules.people.model;

import com.jdd.dao.entity.TArea;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 区域表 封装树结构的区域的名称的实体类
 * <p>
 *
 */
public class AreaIdModel implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private String key;

    /**
     * 主键ID
     */
    private String value;

    /**
     * 区域名称
     */
    private String title;

    List<AreaIdModel> children = new ArrayList<>();

    /**
     * 将SysDepartTreeModel的部分数据放在该对象当中
     * @param treeModel
     * @return
     */
    public AreaIdModel convert(TAreaTreeModel treeModel) {
        this.key = treeModel.getId().toString();
        this.value = treeModel.getId().toString();
        this.title = treeModel.getName();
        return this;
    }

    /**
     * 该方法为用户区域的实现类所使用
     * @param tArea
     * @return
     */
    public AreaIdModel convertByUserDepart(TArea tArea) {
        this.key = tArea.getId().toString();
        this.value = tArea.getId().toString();
        this.title = tArea.getName();
        return this;
    }

    public List<AreaIdModel> getChildren() {
        return children;
    }

    public void setChildren(List<AreaIdModel> children) {
        this.children = children;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
